<?php
global $woodb;
$result = $woodb -> getAllCourses();

echo '
<div class="wrap" >
<h2>Courses</h2>
<p></p>
<table id="example" cellspacing="0">
	<thead>
		<tr>
		    <th>Course</th>
		    <th>Date</th>
		    <th>Actions</th>
		</tr>
	</thead>
	<tfoot>
	    <tr>
	        <th>Course</th>
	        <th>Date</th>
	        <th>Actions</th>
	    </tr>
	</tfoot>
	<tbody>';
	foreach ($result as $r) {
		echo "<tr>
			<td onclick='jQuery(this).editCourse($r->course_id)' class='edit_course'>$r->name</td>
			<td align='center'>" . (($r -> semester == "SS") ? "Spring" : "Fall") . " $r->year</td>
			<td align='center'>
				<img onclick='jQuery(this).cloneCourse($r->course_id)' title='Clone Course' class='clone_course' style='height:22px; width:22px; margin-right:10px;' src='" . get_bloginfo('wpurl') . "/wp-content/plugins/woodle/css/images/clone.png'/>
				<img onclick='jQuery(this).deleteCourse($r->course_id)' title='Delete Course' class = 'remove_course' style='height:22px; width:22px;' src='" . get_bloginfo('wpurl') . "/wp-content/plugins/woodle/css/images/delete.png'/>
			</td>
			</tr>";
	}
	echo '
		</tbody>
		</table>
	</div>
	<p class="submit">
	<input onclick="jQuery(this).addCourse()" type="submit" class="button-primary" value="Add Course" />
	</p>';
	
?>